package com.example.exam.mapper;

import com.example.exam.pojo.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface BookMapper {

    @Insert("INSERT INTO book (name, price,type_no, author, pub_company) VALUES " +
            "(#{name}, #{price},#{typeNo} #{author}, #{pubCompany})")
    int insertBook(Book book);


    @Update("UPDATE book SET name = #{name}, price = #{price},type_no=#{typeNo} author =#{author},pub_company=#{pubCompany} WHERE id=#{id}")
    int updateBookById(Book book);


    @Select("SELECT * FROM book WHERE  id >#{row} LIMIT #{rowNumber} ")
    List<Book> selectBookByLimit(Long row, Long rowNumber);

    @Select("SELECT count(*) FROM book  ")
    int countRow();

    @Delete("delete table book  where  id = #{id} ")
    int deleteBookById(Long id);



}
